package com.sixth.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sixth.core.entity.CareHistory;
import com.sixth.core.entity.OrderBackfee;
import com.sixth.core.entity.OrderCharge;
import com.sixth.core.vo.R;
import com.sixth.service.OrderBackfeeService;
import com.sixth.vo.OrderChargeVo;
import com.sixth.vo.OrderVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: sixth-hospital-parent
 * @description:
 * @author: 李劲锋
 * @create: 2024-08-19 15:32
 **/
@RestController
@RequestMapping("/charge/backFee")
@Api(tags = "退费接口")
public class OrderBackfeeController {
    @Autowired
    private OrderBackfeeService orderBackfeeService;
    @PostMapping( "/selectFee/{registrationId}")
    @ApiOperation(value = "查询退费信息")
    public R<List<CareHistory>> queryBackFee(@PathVariable String registrationId) {
        return orderBackfeeService.selectByIdFee(registrationId);
    }
    @PostMapping("/OrderbackFee")
    @ApiOperation(value = "退费")
    public R orderBackFee(@RequestBody OrderChargeVo orderChargeVo) {
        return orderBackfeeService.orderBackFee(orderChargeVo);
    }

    @PostMapping("/listByPage")
    @ApiOperation(value = "分页查询退费信息")
    public R<IPage<OrderBackfee>> list(@RequestBody OrderVo orderVo){
        return orderBackfeeService.selectByPage(orderVo);
    }

    @PostMapping("/createRefundWx")
    @ApiOperation(value = "创建微信退款")
    public R createRefundWx(@RequestBody OrderChargeVo orderChargeVo) {
        return orderBackfeeService.createRefundWx(orderChargeVo);
    }

    @PostMapping("/dispensing")
    @ApiOperation(value = "退费状态")
    public R dispensingStatus(@RequestBody OrderChargeVo orderChargeVo) {
        return orderBackfeeService.dispensingStatus(orderChargeVo);
    }

    @PostMapping("/app/back")
    @ApiOperation(value = "app端批量退费")
    public R orderClientBackFee(@RequestBody List<String> orderIds) {
        return orderBackfeeService.orderClientBackFee(orderIds);
    }


}
